package br.com.dev.tcc.bean.sinistro;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import android.content.Context;
import br.com.dev.tcc.R;
import br.com.dev.tcc.bean.Plano;

public enum TipoSinistro {

	COLISAO(1, R.string.colisao, R.drawable.colisao), 
	INCENDIO(2, R.string.incendio, R.drawable.incendio),
	ROUBO_FURTO(3, R.string.roubo, R.drawable.roubo),
	ATROPELAMENTO(4, R.string.atropelamento, R.drawable.atropelamento),
	ENCHENTE(5, R.string.enchente, R.drawable.enchente),
	VIDRO(6, R.string.vidro_acessorios, R.drawable.vidro_quebrado);

	private int code;
	private int stringId;
	private int iconId;

	TipoSinistro(int code, int stringId, int iconId) {
		this.code = code;
		this.stringId = stringId;
		this.iconId = iconId;
	}

	public int getCode() {
		return code;
	}
	
	public int getStringId() {
		return stringId;
	}

	public int getIconId() {
		return iconId;
	}

	public static List<TipoSinistro> getByPlano(Plano plano){
		
		int idPlano = plano.getId();
	
		switch (idPlano) {
		case 1:
			return Arrays.asList(values());
		case 2:
			return Arrays.asList(COLISAO, ROUBO_FURTO, ATROPELAMENTO, ENCHENTE);
		case 3:
			return Arrays.asList(COLISAO, ROUBO_FURTO);
		}
		
		return new ArrayList<TipoSinistro>();
	}
	
	public String getDescricao(Context context){
		return context.getString(stringId);
	}
}
